******************************************************************************************************************
***************************************************************************
* Title: THE HILLARY HYPOTHESES - TESTING CANDIDATE VIEWS OF LOSS 
* Authors: Michael Lewis-Beck and Stephen Quinlan
* 
* SPSS ANES TIME SERIES CUMULATIVE ANALYSIS & INDIVIDUAL ELECTION STUDY ANALYSIS
*  FOR FIGURE 1 IN PAPER
* Transformations and analysis to be run on ANES Time Series Cumulative File 
* 1948-2016 (data version date: May 31, 2018) & 1992 and 2008 ANES Time S
* Series Studies
* Last updated: Friday 19 October 2018
***************************************************************************
******************************************************************************************************************

******************************************************************************************************************
NAVIGATION OF SYNTAX FILE

* /// SECTION HEADER 
* >>> VARIABLE HEADER
* <<< SUB VARIABLE HEADER
* \\\ HEADER FOR DIFFERENT LOOPS OF CODE WITHIN A VARIABLE HEADER
******************************************************************************************************************


******************************************************************************************************************
SYNTAX FILE IS SPLIT UP INTO FOLLOWING SECTIONS:
* /// 1) DEMOCRATIC SUPPORT FOR DEMOCRATIC PRESIDENTIAL CANDIDATE OVER TIME 
* /// 2) DEMOCRATIC PRIMARY VOTERS AND SUPPORT FOR DEMOCRATIC CANDIDATE IN 
*        PRESIDENTIAL ELECTIONS
******************************************************************************************************************


******************************************************************************************************************
/// 1) DEMOCRATIC SUPPORT FOR DEMOCRATIC PRESIDENTIAL CANDIDATE OVER TIME 
* Data for 1988-2012 inclusive taken from this data. 2016 data comes from
* the individual 2016 ANES Time Series Cumulative dataset 1948-2016
******************************************************************************************************************

***************************************************************************
*>>> RECODE OF PARTISANSHIP INTO THREE CATEGORY VARIABLE 
***************************************************************************

RECODE VCF0301 (4=2) (1 thru 3=1) (5 thru 7=3) (ELSE=SYMSIS) INTO PartyID_3CAT.
VARIABLE LABELS  PartyID_3CAT 'PartyID_Dem'.
VALUE LABELS PartyID_3CAT 1 'Democrats' 2 'Independents' 3 'Republican'.
EXECUTE.


***************************************************************************
*>>> RECODE OF VOTE INTO THREE CATEGORY VARIABLE 
***************************************************************************

RECODE VCF0704 (1=1) (3=2) (2=3) (ELSE=SYSMIS) INTO Vote_Pres.
VARIABLE LABELS  Vote_Pres 'Vote: Presidential election'.
VALUE LABELS Vote_Pres 1 'Democrats' 2 'Independents/Third Party' 3 'Republican'.
EXECUTE.


***************************************************************************
*>>> CROSS-TABLE OF VOTE IN PRESIDENTIAL ELECTION BY PARTISANSHIP BY YEAR
***************************************************************************

***************************************************************************
*>>> FIGURE 1 (TOP-LEFT QUADRANT)
* Data for 1988-2012 inclusive taken from this data. 2016 data comes from
* the individual 2016 ANES Time Series dataset. 
***************************************************************************

CROSSTABS
  /TABLES=Vote_Pre BY PartyID_3CAT BY VCF0004
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT COLUMN 
  /COUNT ROUND CELL.


******************************************************************************************************************
/// 2) DEMOCRATIC PRIMARY VOTERS AND SUPPORT FOR DEMOCRATIC CANDIDATE IN 
*      PRESIDENTIAL ELECTIONS
* Data for 1988-2012 inclusive taken from this data. 2016 data comes from
* the individual 2016 ANES Time Series dataset. 
******************************************************************************************************************


****************************************************************************
>>> 1992
* Please note: Use 1992 ANES Time Series Study 
****************************************************************************

* <<< Vote Choice in Democratic Primary 1992

RECODE v923304 (1=1) (2 thru 7=0) (ELSE=SYSMIS) INTO DemPrimVote1.
VARIABLE LABELS  DemPrimVote1 'Voted in Democratic Primary (Dichotomy)'.
VALUE LABELS DemPrimVote1 0 'Voted for another Democrat' 1 'Voted for Bill Clinton'.
EXECUTE.


* <<< Vote Choice in Democratic Primary 1992 (main BC opponent)

RECODE v923304 (1=1) (2=0) (4 thru 7=0) (3=2) (ELSE=SYSMIS) INTO DemPrimVote2.
VARIABLE LABELS  DemPrimVote2 'Voted in Democratic Primary (Multiple)'.
VALUE LABELS DemPrimVote2 0 'Voted for another Democrat' 1 'Voted for Bill Clinton' 2 'Voted for Jerry Brown'.
EXECUTE.


* <<< Vote Choice in 1992 Presidential election

RECODE v925609 (1=1) (2=2) (3=3) (ELSE=SYSMIS) INTO VoteChoice92.
VARIABLE LABELS  VoteChoice92 'Vote Choice: 1992'.
VALUE LABELS VoteChoice92 1 'Voted for George Bush' 2 'Voted for Bill Clinton' 3 'Voted for Ross Perot/Other'.
EXECUTE.


* <<< Cross-tab Vote choice in 1992 and Vote in Primary 

CROSSTABS
  /TABLES=VoteChoice92 BY DemPrimVote1 DemPrimVote2
  /FORMAT=AVALUE TABLES
  /STATISTICS=CHISQ GAMMA KAPPA 
  /CELLS=COUNT COLUMN 
  /COUNT ROUND CELL.


****************************************************************************
>>> 2008
* Please note: Use 2008 ANES Time Series Study 
****************************************************************************


* <<< Vote Choice in Democratic Primary 2008

RECODE V083077a (12=1) (1 thru 4=0) (10=0) (14=0) (ELSE=SYSMIS) INTO DemPrimVote1.
VARIABLE LABELS  DemPrimVote1 'Voted in Democratic Primary (Dichotomy)'.
VALUE LABELS DemPrimVote1 0 'Voted for another Democrat' 1 'Voted for Barack Obama'.
EXECUTE.


* <<< Vote Choice in Democratic Primary 2008 (main BO opponent)

RECODE V083077a (12=1) (3 thru 4=0) (10=0) (14=0) (2=2) (1=1) (ELSE=SYSMIS) INTO DemPrimVote2.
VARIABLE LABELS  DemPrimVote2 'Voted in Democratic Primary (Multiple)'.
VALUE LABELS DemPrimVote2 0 'Voted for another Democrat' 1 'Voted for Barack Obama' 2 'Voted for Hillary Clinton'.
EXECUTE.


* <<< Vote Choice in 2008 Presidential election

RECODE V085044a (1=2) (3=1) (7=3) (ELSE=SYSMIS) INTO VoteChoice08.
VARIABLE LABELS  VoteChoice08 'Vote Choice: 2008'.
VALUE LABELS VoteChoice08 1 'Voted for McCain' 2 'Voted for Barack Obama' 3 'Other'.
EXECUTE.


* <<< Cross-tab Vote choice in 2008 and Vote in Primary 

CROSSTABS
  /TABLES=VoteChoice08 BY DemPrimVote1 DemPrimVote2
  /FORMAT=AVALUE TABLES
  /STATISTICS=CHISQ GAMMA KAPPA 
  /CELLS=COUNT COLUMN 
  /COUNT ROUND CELL.


// END OF FILE